#include "MyLogger.h"

void A::Dump()
{
    auto dumpItem = [this](auto name,auto& item){
        std::cout << name << " @ " << (void*)&item << " , size is " << sizeof(item) << std::endl;
    };
    dumpItem("m_a",m_a);
    dumpItem("m_b",m_b);
    dumpItem("m_c",m_c);
    dumpItem("m_d",m_d);
    std::cout << "Obj size: " << sizeof(*this) << std::endl;
}

A::A()
{
    PRINTFUN_ADDR;
}

A::~A()
{
    PRINTFUN_ADDR;
}

A::A(int a,int b,int c,uint8_t d):
    m_a(a),
    m_b(b),
    m_c(c),
    m_d(d)
    {
        PRINTFUN_ADDR;
    }

// A::A(const A& other):
// A(other.m_a,other.m_b,other.m_c,other.m_d)
// {
//     PRINTFUN_ADDR;
// }

A::A(const A& other):
m_a(other.m_a),m_b(other.m_b),m_c(other.m_c),m_d(other.m_d)
{
    PRINTFUN_ADDR;
}

A& A::operator=(const A&other)
{
    m_a = other.m_a;
    m_b = other.m_b;
    m_c = other.m_c;
    m_d = other.m_d;
    PRINTFUN_ADDR;
    return *this;
}

int A::sum()
{
    return m_a + m_b + m_c + m_d;
}